<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/5 0005
  Time: 下午 4:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>Title</title>

    <script src="../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">
    <style>
      .duan{
          float:left;
          width:15%;
          height:80%;
      }
    </style>
</head>
<body>
<ul id="tree" class="duan"></ul>
<iframe name="rightIframe" id="rightIframe" src="/adminSystem/givePermission?type=${type}&id=${id}&permissionId=0" style="width:80% !important;height:80% !important;float:right;margin-bottom: -100px !important;" ></iframe>
</body>
<script type="application/javascript">
    layui.use('tree', function() {
        layui.tree({
            elem: '#tree' //传入元素选择器
            ,target:'rightIframe'
            , nodes:[ //节点
                {name:'一级目录'
                    ,id: '${id}'
                    ,alias: '${type}'
                    ,href:'/adminSystem/givePermission?type=${type}&id=${id}&permissionId=0'
                },
                <c:forEach items="${oneList}" var="one" end="0">
                {
                    name: '${one.name}'
                    ,id: '${one.id}'
                    ,alias: '${one.url}'
                    ,href:'/adminSystem/givePermission?type=${type}&permissionId=${one.id}&id=${id}'
                    ,children:
                    [<c:forEach items="${one.twoPermission}" var="two" end="0">
                        {
                        name: '${two.name}'
                        ,id: '${two.id}'
                        ,href: '/adminSystem/givePermission?type=${type}&permissionId=${two.id}&id=${id}'
                        ,alias: '${two.url}'
                        }
                    </c:forEach>
                    <c:forEach items="${one.twoPermission}" var="two" begin="1">
                    ,
                    {
                        name: '${two.name}'
                        ,id: '${two.id}'
                        ,href: '/adminSystem/givePermission?type=${type}&permissionId=${two.id}&id=${id}'
                        ,alias: '${two.url}'
                    }
                    </c:forEach>
                    ]

                }
                </c:forEach>
                <c:forEach items="${oneList}" var="one" begin="1">
                ,
                {
                    name: '${one.name}'
                    ,id: '${one.id}'
                    ,alias: '${one.url}'
                    ,href:'/adminSystem/givePermission?type=${type}&permissionId=${one.id}&id=${id}'
                    ,children:
                    [<c:forEach items="${one.twoPermission}" var="two" end="0">
                    {
                        name: '${two.name}'
                        ,id: '${two.id}'
                        ,href: '/adminSystem/givePermission?type=${type}&permissionId=${two.id}&id=${id}'
                        ,alias: '${two.url}'
                    }
                    </c:forEach>

                    <c:forEach items="${one.twoPermission}" var="two" begin="1">
                    ,
                    {
                        name: '${two.name}'
                        ,id: '${two.id}'
                        ,href: '/adminSystem/givePermission?type=${type}&permissionId=${two.id}&id=${id}'
                        ,alias: '${two.url}'
                    }
                    </c:forEach>
                ]
                }
                </c:forEach>
            ]
        });
    })
</script>

</html>
